/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hhf.worldzones.services.locationServices.regionServices;

import hhf.flex.annotations.services.ShowBusyCursor;
import hhf.worldzones.daos.RegionDAO;
import hhf.worldzones.entities.Region;
import hhf.worldzones.exceptions.EntityUnknownException;
import hhf.worldzones.exceptions.RegionUnknownException;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.inject.Inject;
import org.slf4j.Logger;

/**
 *
 * @author HHFrancois
 */
@Stateless
public class RegionFacade implements RegionFacadeLocal {

    @Inject
    Logger logger;
    @EJB
    RegionDAO regionDAO;

    @Override
    public void remove(Region entity) {
        logger.debug("remove Region : " + entity.getLabel());
        //regionDAO.remove(entity);
    }

    @Override
    public void persist(Region entity) {
        logger.debug("persist Region : " + entity.getLabel());
        //regionDAO.persist(entity);
    }

    @Override
    public Region merge(Region entity) {
        return regionDAO.merge(entity);
    }

    @Override
    public List<Region> findRange(int[] range) {
        return regionDAO.findRange(range);
    }

    @Override
    public List<Region> findAll() {
        return regionDAO.findAll();
    }

    @Override
    public int count() {
        return regionDAO.count();
    }

    @Override
    @ShowBusyCursor
    public Region find(String id) throws RegionUnknownException {
        Region r;
        try {
            r = regionDAO.find(id);
        } catch (EntityUnknownException ex) {
            throw new RegionUnknownException(ex);
        }
        return r;
    }
}
